import 'package:chop/Model/address_entity.dart';
import 'package:chop/common/configs.dart';
import 'package:chop/widgets/appBar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart';
class NewLocation extends StatefulWidget {
  @override
  _NewLocationState createState() => _NewLocationState();
}

class _NewLocationState extends State<NewLocation> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PlacePicker(
        apiKey: Configs.API_KEY,   // Put YOUR OWN KEY here.
        onPlacePicked: (result) {
          print(result.formattedAddress);
          print(result.geometry.location);
          AdrEntityData adrEntityData = AdrEntityData();
          adrEntityData.lat = result.geometry.location.lat.toString();
          adrEntityData.lng = result.geometry.location.lng.toString();
          adrEntityData.address = result.formattedAddress;
          Get.back(result: adrEntityData);
        },
//        initialPosition: HomePage.kInitialPosition,
        useCurrentLocation: true,
      ),
    );
  }
}

